FUNCTION DAC_GetBitOfWord :BOOL
TITLE = 'DAC_GetBitOfWord'
//
// This functionblock extract a single bit of a word
// 
// Versionshistory:
// 1.0 Ersterstellung E.Dittmann

VERSION : '1.0'
AUTHOR  : 'Lenze'
FAMILY  : 'DAC'
NAME : 'xofw'
KNOW_HOW_PROTECT

VAR_INPUT
    wInput:                     WORD;                               // Inputword
    byBitNr:                    BYTE;                               // Bitnumber (Range 0 - 15)
END_VAR

VAR
END_VAR

BEGIN
DAC_GetBitOfWord := false;
IF (BYTE_TO_INT(byBitNr) >= 0) AND (BYTE_TO_INT(byBitNr) < 16) THEN
    DAC_GetBitOfWord := WORD_TO_INT((SHR(IN:=wInput,N:=BYTE_TO_INT(byBitNr)) AND 16#0001)) > 0;    
END_IF;


END_FUNCTION
